package com.codechuan.hallo_internal.ui.notifications;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;

import com.codechuan.hallo_internal.R;
import com.codechuan.hallo_internal.common.Constant;
import com.codechuan.hallo_internal.databinding.FragmentNotificationsBinding;
import com.codechuan.hallo_internal.ui.myOrder.MyOrder;
import com.codechuan.hallo_internal.utils.ContextUtil;
import com.codechuan.hallo_internal.utils.DialogUtil;
import com.codechuan.hallo_internal.utils.MyProjectHttpUtil;

/**
 * @Deprecated 个人中心
 */
public class NotificationsFragment extends Fragment implements View.OnClickListener {

    private FragmentNotificationsBinding binding;

    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {
        binding = FragmentNotificationsBinding.inflate(inflater, container, false);
        binding.tokenText.setText(Constant.token);
        binding.TimeText.setText(Constant.dq_time);
        // 获取解绑按钮
        Button noBind = binding.noBind;
        noBind.setOnClickListener(this);
        return binding.getRoot();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        binding = null;
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.noBind) {
            Constant.executorService.execute(() -> {
               String message =  MyProjectHttpUtil.noBind(Constant.keyNumber);
                Constant.handler.post(() -> {
                    DialogUtil.showDialog(ContextUtil.context,message);
                });
            });

        }
    }
}